<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>5.class</title>
</head>
<body>
  <!-- 5.class -->
  class 实际上是函数的语法糖 

  <script>
    class Person {
      constructor(name) {
        this.name = name
      }

      eat() {
        console.log(`${this.name} eat something`);
      }
    }

    // 继承
    class Student extends Person {
      constructor(name, no) {
        super(name)
        this.no = no
      }

      learn() {
        console.log(`学号：${this.no},${this.name} 正在学习`);
      }
    }

    const stu = new Student('xialuo', 100)
    console.log(stu.__proto__);
    console.log(Student.prototype);
    // console.log(stu.name);
    // stu.eat()
    // stu.learn()




  </script>
  
</body>
</html>
